import { Module } from '@nestjs/common';
import * as path from "path"

@Module({
  providers: [
    {
      provide: 'PromoptWords',
      useFactory: async () => {
        try {
          const promoptwordsPath = path.join(process.cwd(), 'assets/rstcc-promote.txt')
          const text = await import('fs').then(fs => fs.readFileSync(promoptwordsPath, 'utf-8'));
          // console.log("提示词加载成功！")
          return text;
        } catch (e) {
          console.log("提示词加载失败！", e)
          return ''
        }
      }
    }
  ],
  exports: ['PromoptWords']
})
export class PromoptWordsModule { }